home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
compress
/
shrink
/
shrink.txt
Wrap
Text File
|
1994-03-09
|
3KB
|
76 lines
CUT VB/WIN 3.0 EXE's SIZE BY UP TO 50%
======================================
How can you cut the size of your EXE file by 50% without changing one line of code?
I recently reduced a 2.5 mg EXE file to 1.4 mg without changing one line of code!!
HISTORY
=======
The other day I was working on a VB/WIN 3.0 App that uses a lot of bitmaps that are
attached to image and picture controls at design time. The project was up to 2.5 mg
and still growing. I was using 16 color bitmaps designed in a paint package that
allows me to design in 256 colors and dither to 16 colors (for the smallest color
DIBs possible).
The Bitmap files were nice and small and other image packages verified that the
bitmaps were indeed 16 color bitmaps. But I noticed the Binary files VB created
were extremely large when bitmaps are added at design time. But when the picture
controls were emptied and the form resaved, the form files were small.
I tried switching to text mode for the form and the resulting .FRX binary file
was still very large. Over twice the size of the bitmaps assigned to the form --
what gives??
After a little experimenting, I discovered what VB/WIN was doing behind the scenes.
Even though I was loading 16 color (small) bitmaps and assigning them to the picture
controls at design time, VB was storing them in 256 color mode in the binary form file
(as well as the FRX file in text mode). This resulted in a consistent 45-50% increase
in binary storage that was then "compiled" into the final EXE. WOW, what a waste!
I then dug out an old 16 color video board and driver set and changed my system. I put
the accelerated 256 color board and driver onto the shelf for a while. I then opened the
VB Project files and accessed each form that contained each 16 color bitmaps and did
the folowing:
1) unassigned each bitmap them from their respective picture controls
2) saved the form (without any bitmaps)
3) reassigned the bitmaps to the pitcure controls
4) saved the form again (with the bitmaps)
5) generated a new EXE for the project
(NOTE - the two saves involved - they were required to get VB to change the binary files
that stored the bitmap images)
Not only did the form's binary files decrease by 50%, the same reduction was seen
in the final EXE. Up to 50% savings!!
For some reason, it appears Microsoft assumes that whatever color mode you are
designing in is the one you wish the application to run in. They do not take
into account the color level the bitmap images on the form are in.
I wonder what would happen if I put my accelerated video board back in and opened up
windows and VB in 24 bit color mode. Would the EXE grow to 10 or 15MG even though I am
using 16 color bitmaps??
Would end users running my app in 16 color mode suffer from 256-to-16 color dithering
or 24 bit-to-16 color dithering time lags?
I have looked through all the materials I can find on VB and have not found anything
on this subject or how to control this problem other than desiging in 16 color mode.
If anyone else has run across this "design assumption feature" of VB/WIN 3.0 and have
anything else to add, please e-mail me at 72074,2677.
I hope this discussion saves someone out there some space in there EXE files.
Jay J. Falconer
Bitwise Software International, Inc.
72074,2677